<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>添加</title>
</head>
<link rel="stylesheet" href="/static/layui/css/layui.css"/>
<body>
<form class="layui-form" id="record-add" action="" lay-filter="add">
    <!--<div class="layui-form-item">
        <label class="layui-form-label">用户编号：</label>
        <div class="layui-input-inline">
            <input type="text" name="auserId" id="auserId" lay-verify="required" autocomplete="off" class="layui-input">
        </div>
    </div>-->
    <!--<div class="layui-form-item">
        <label class="layui-form-label">角色：</label>
        <div class="layui-input-inline">
            <input type="tel" name="roletype" id="roletype" lay-verify="required" autocomplete="off" class="layui-input">
        </div>-->
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">账号：</label>
        <div class="layui-input-inline">
            <input type="tel" name="auser" id="auser" lay-verify="required" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">密码：</label>
        <div class="layui-input-inline">
            <input type="tel" name="apassword" id="apassword" lay-verify="required" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">姓名：</label>
        <div class="layui-input-inline">
            <input type="tel" name="aname" id="aname" lay-verify="required" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">性别：</label>
        <div class="layui-input-inline">
            <input type="tel" name="asex" id="asex" lay-verify="required" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">手机号：</label>
        <div class="layui-input-inline">
            <input type="tel" name="aphone" id="aphone" lay-verify="required" autocomplete="off" class="layui-input">
        </div>
    </div>
    <!--<div class="layui-form-item">
        <label class="layui-form-label">注册时间：</label>
        <div class="layui-input-inline layui-col-md4">
            <input type="text" name="atime" id="atime"  required  lay-verify="required"  autocomplete="off" class="layui-input">
        </div>
    </div>-->
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
        </div>
    </div>
</form>
</body>

<script src="/static/js/jquery-3.3.1.js"></script>
<script src="/static/layui/layui.js"></script>
<script>
    /*laydate.render({
        elem:'#time',//指定元素
        type:'date'  //年选择器
    });*/

    layui.use(['form', 'laydate'], function () {
        var form = layui.form;
        var laydate = layui.laydate;
        //常规用法
        laydate.render({
            elem:'#atime',//指定元素
            type: 'datetime',
            value: new Date(new Date())
        });

        //监听提交
        form.on('submit(formDemo)', function (data) {
            var data1 = form.val("add");
            $.ajax({
                url: '/UserAdd',
                type: "get",
                dataType: "json",
                data: data1,
                success: function (da) {
                    if (da.code == 200) {
                        layer.alert("添加成功！", function () {
                            window.parent.location.reload();//刷新父页面
                            // parent.layer.close(layer.index);//关闭弹出层
                            parent.layer.closeAll();
                        });
                    } else {
                        layer.msg("添加失败！");
                    }
                }
            });
            return false;
        });

    });
</script>
</html>